
export default (router, services, middleswares) => {
    //获取用户的基本信息
    router.get("/middle/getUserInfo", middleswares.handler, async (ctx, next) => {
        const resUserRisk = await services.userAccount.checkUserRisk(ctx);
        const resUserBalance = await services.userAccount.checkUserBalance(ctx);
        const resUserCard = await services.userAccount.checkUserCard(ctx);
        const resUserAutobid = await services.userAccount.checkUserAutobid(ctx);
        const resUserZyhq = await services.userAccount.checkUserZyhq(ctx);
        //判断风险等级
        const count = resUserRisk.data.riskValue;
        if (count >= -9 && count <= 15) {
            resUserRisk.data.riskString = '保守型';
        } else if (count >= 16 && count <= 35) {
            resUserRisk.data.riskString = '谨慎型';
        } else if (count >= 36 && count <= 60) {
            resUserRisk.data.riskString = '稳健型';
        } else if (count >= 61 && count <= 80) {
            resUserRisk.data.riskString = '进取型';
        } else if (count >= 81 && count <= 100) {
            resUserRisk.data.riskString = '激进型';
        };
        ctx.body = {
            resUserRisk: resUserRisk.data,
            resUserBalance: resUserBalance.data,
            resUserCard: resUserCard.data,
            resUserAutobid: resUserAutobid.data,
            resUserZyhq: resUserZyhq.data
        }
    })
}